package com.qf.fmmall.controller;

import com.qf.fmmall.entity.Orders;
import com.qf.fmmall.service.OrderService;
import com.qf.fmmall.vo.ResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("order")
@CrossOrigin
@Api(value = "订单接口",tags = "处理订单业务")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @RequestMapping(value = "add",method = RequestMethod.POST)
    @ApiOperation("添加订单接口-->提交订单")
    public ResultVo addOrder(String cids,@RequestBody Orders order){
       return orderService.add(cids,order);
    }

    @RequestMapping(value = "status/{orderId}",method = RequestMethod.GET)
    @ApiOperation("查询订单状态接口")
    public ResultVo queryOrderStatus(@PathVariable("orderId") String orderId){
        return orderService.queryOrderStatus(orderId);
    }
}
